package personal.xjl._23java1studentdemo.mapper;

import org.apache.ibatis.annotations.*;
import personal.xjl._23java1studentdemo.model.Score;
import personal.xjl._23java1studentdemo.model.Student;

import java.util.List;

@Mapper
public interface ScoreMapper {

    @Select("select  * from score where student_id=#{studentId}")
    @Results({
            @Result(column = "course_id",property = "course",javaType = String.class,
            one= @One(select = "personal.xjl._23java1studentdemo.mapper.CourseMapper.findById")
            )
    })
    List<Score> selectByStudentId(int studentId);


    @Select("select * from score where course_id = #{courseId}")
    @Results({
            @Result(column = "student_id",property = "student",javaType = Student.class,
            one = @One(select = "personal.xjl._23java1studentdemo.mapper.StudentMapper.selectById")
            )
    })
    List<Score> selectByCourseId(int courseId);
}
